package com.songtai.service.impl;

import java.io.Serializable;

import com.songtai.dao.JobInfoDao;
import com.songtai.po.JobInfo;
import com.songtai.service.JobInfoService;
import com.songtai.util.PageBean;

/**
 * 职位信息
 * 
 * @author lx
 * 
 */
public class JobInfoServiceImpl implements JobInfoService {

	private JobInfoDao jobInfoDao;

	@Override
	public void delJobInfos(String ids) {
		String temp = ids.substring(0, ids.length() - 1);
		String[] temp2 = temp.split(",");
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < temp2.length; i++) {
			sb.append("'" + temp2[i] + "',");
		}
		temp = sb.toString();
		temp = temp.substring(0, temp.length() - 1);
		String hql = "delete from JobInfo where id in(" + temp + ")";
		jobInfoDao.deleteEntities(hql);
	}

	@Override
	public JobInfo getJobInfo(Serializable id) {
		return jobInfoDao.readObjectById(id);
	}

	@Override
	public PageBean getJobInfos(PageBean pageBean) {
		return jobInfoDao.findPageEntities(pageBean);
	}

	@Override
	public void saveJobInfo(JobInfo jobInfo) {
System.out.println("--------添加职位信息");
		jobInfoDao.createObject(jobInfo);
	}

	@Override
	public void updateJobInfo(JobInfo jobInfo) {
		jobInfoDao.updateObject(jobInfo);
	}
	@Override
	public void saveOrUpdateJobInfo(JobInfo jobInfo) {
		jobInfoDao.saveOrUpdateEntity(jobInfo);
	}

	public void setJobInfoDao(JobInfoDao jobInfoDao) {
		this.jobInfoDao = jobInfoDao;
	}

}
